using System.Data;
using ET;
namespace DAL
{
    public class Export_Detail_DAL
    {
        private readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdtb_Export_Detail(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Export_Detail_Search");
        }
        public DataTable BindGirdtb_Export_Materials(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Export_ID", id);
            return cls.GetData("sp_tb_Export_Detail_Proposed");
        }
        public DataTable BindGirdtb_Export_Materials_Edit(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Export_ID", id);
            return cls.GetData("sp_tb_Export_Detail_Proposed_Edit");
        }

        #endregion

        #region Insert
        public bool Inserttb_Export_Detail(Export_Detail_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Export_ID", data.Export_ID);
            cls.AddParameter("@Materials_ID", data.Materials_ID);
            cls.AddParameter("@Export_Detail_Quality_Voucher", data.Export_Detail_Quality_Voucher);
            cls.AddParameter("@Export_Detail_Quality_HaveExport", data.Export_Detail_Quality_HaveExport);
            cls.AddParameter("@Export_Detail_Quality", data.Export_Detail_Quality);
            cls.AddParameter("@Export_Detail_Price", data.Export_Detail_Price);
            return cls.ExecuteNonQuery("sp_tb_Export_Detail_Insert");
        }
        #endregion

        #region Update
        public bool Updatetb_Export_Detail(Export_Detail_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Export_Detail_ID", data.Export_Detail_ID);
            cls.AddParameter("@Export_ID", data.Export_ID);
            cls.AddParameter("@Materials_ID", data.Materials_ID);
            cls.AddParameter("@Export_Detail_Quality_Voucher", data.Export_Detail_Quality_Voucher);
            cls.AddParameter("@Export_Detail_Quality_HaveExport", data.Export_Detail_Quality_HaveExport);
            cls.AddParameter("@Export_Detail_Quality", data.Export_Detail_Quality);
            cls.AddParameter("@Export_Detail_Price", data.Export_Detail_Price);
            return cls.ExecuteNonQuery("sp_tb_Export_Detail_Update");
        }
        #endregion

        #region Delete
        public bool Deletetb_Export_Detail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Export_Detail_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Export_Detail_Delete");
        }
        public bool Deletetb_Export_Detail_Default_ID(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Export_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Export_Detail_Delete_Default");
        }
        #endregion

        #region Sum
        public DataTable Sum_Export_Detail_Quality_HaveExport(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Material_ID", id);
            return cls.GetData("sp_tb_Export_Detail_Sum_Quality_HaveExport");
        }
        #endregion
    }
}